/**************************************************
|	File:		CreditState.cpp
|	Author:		Benjamin Budian
|	Course:		SGD
|	Purpose:	Handles rendering the credits
**************************************************/
#include "CreditsState.h"

//Wrappers
#include "../SGD Wrappers/CSGD_XAudio2.h"
#include "../SGD Wrappers/CSGD_Direct3D.h"
#include "../SGD Wrappers/CSGD_DirectInput.h"
#include "../SGD Wrappers/SGD_String.h"

//Local
#include "Game.h"
#include "MainMenuState.h"

CCreditsState::CCreditsState(void){}

CCreditsState::~CCreditsState(void){}

CCreditsState* CCreditsState::GetInstance(){
	static CCreditsState sInstance;
	return &sInstance;
}

void CCreditsState::Enter(){}

void CCreditsState::Exit(){}

bool CCreditsState::Input(){
	CSGD_DirectInput* pDI = CSGD_DirectInput::GetInstance();

	if(pDI->KeyPressed(DIK_ESCAPE) == true){
		CGame::GetInstance()->ChangeState( CMainMenuState::GetInstance() );
	}

	return true;
}

void CCreditsState::Update( float fElapsedTime ){}

void CCreditsState::Render(){
	CBitmapFont* pFont = CGame::GetInstance()->GetFont();

	int nCenterOffset = CGame::GetInstance()->GetScreenWidth()/2 - (strlen("Credits")*64)/2;
	pFont->Draw( _T("Credits"), nCenterOffset, 100, 2.0f, D3DCOLOR_ARGB(255, 255, 255, 255) );

	nCenterOffset = CGame::GetInstance()->GetScreenWidth()/2 - (strlen("Designed By: ")*16)/2;
	pFont->Draw(_T("Designed By: "), nCenterOffset, 300, .5f,D3DCOLOR_ARGB(255, 255, 255, 255));

	nCenterOffset = CGame::GetInstance()->GetScreenWidth()/2 - (strlen("Benjamin Budian in Structure of Game Design")*16)/2;
	pFont->Draw(_T("Benjamin Budian in Structure of Game Design"), nCenterOffset, 325, .5f,D3DCOLOR_ARGB(255, 255, 255, 255));

	nCenterOffset = CGame::GetInstance()->GetScreenWidth()/2 - (strlen("at Full Sail University")*16)/2;
	pFont->Draw(_T("at Full Sail University"), nCenterOffset, 350, .5f,D3DCOLOR_ARGB(255, 255, 255, 255));

	nCenterOffset = CGame::GetInstance()->GetScreenWidth()/3 - (strlen("Image Credits:")*16)/2;
	pFont->Draw(_T("Image Credits:"), nCenterOffset, 400, .5f,D3DCOLOR_ARGB(255, 255, 255, 255));

	nCenterOffset = CGame::GetInstance()->GetScreenWidth()/3 - (strlen("www.opengameart.org")*16)/2;
	pFont->Draw(_T("www.opengameart.org"), nCenterOffset, 425, .5f,D3DCOLOR_ARGB(255, 255, 255, 255));
	
	nCenterOffset = CGame::GetInstance()->GetScreenWidth()/3 - (strlen("- search for LPC")*16)/2;
	pFont->Draw(_T("- search for LPC"), nCenterOffset, 450, .5f,D3DCOLOR_ARGB(255, 255, 255, 255));
	

	nCenterOffset = CGame::GetInstance()->GetScreenWidth()/3 * 2 - (strlen("Sound Credits:")*16)/2;
	pFont->Draw(_T("Sound Credits:"), nCenterOffset, 400, .5f,D3DCOLOR_ARGB(255, 255, 255, 255));

	nCenterOffset = CGame::GetInstance()->GetScreenWidth()/3 * 2 - (strlen("www.soundbible.com")*16)/2;
	pFont->Draw(_T("www.soundbible.com"), nCenterOffset, 425, .5f,D3DCOLOR_ARGB(255, 255, 255, 255));
	
	nCenterOffset = CGame::GetInstance()->GetScreenWidth()/3 * 2 - (strlen("www.freesound.org")*16)/2;
	pFont->Draw(_T("www.freesound.org"), nCenterOffset, 450, .5f,D3DCOLOR_ARGB(255, 255, 255, 255));
	
}

